package com.jinmdz.fmis.api.api.controller;

import com.jinmdz.fmis.api.api.model.funeral.BusinessCodeData;
import com.jinmdz.fmis.api.api.model.funeral.agreement.ServiceAgreementItem;
import com.jinmdz.fmis.api.api.model.funeral.negotiation.ServiceNegotiationItem;
import com.jinmdz.fmis.api.api.service.ServiceNegotiationService;
import com.jinmdz.fmis.api.base.BaseController;
import com.jinmdz.fmis.core.base.BaseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


/**
 * 服务洽谈信息登记相关接口
 *
 * @author LiCongLu
 * @date 2020-01-20 10:35
 */
@Api(description = "服务洽谈信息登记相关接口")
@RestController()
@RequestMapping("/api/service-negotiation")
public class ServiceNegotiationController extends BaseController {

    @Resource
    private ServiceNegotiationService serviceNegotiationService;

    /**
     * 根据funeral_dead表中businessCode加载服务洽谈登记信息
     *
     * @param data 业务编码数据
     * @return
     * @author LiCongLu
     * @date 2020-01-20 10:37
     */
    @ApiOperation(value = "根据funeral_dead表中businessCode加载服务洽谈登记信息", notes = "根据businessCode加载服务洽谈信息，信息包括：基本信息、接运、冷藏、整容、守灵、告别、火化、丧葬用品及服务")
    @PostMapping("/load-service-negotiation-with-business-code")
    public BaseResult<ServiceNegotiationItem> loadServiceNegotiationWithBusinessCode(@RequestBody BusinessCodeData data) {
        return resultHandler(data, userItem -> serviceNegotiationService.loadServiceNegotiationWithBusinessCode(data));
    }

    /**
     * 根据funeral_dead表中businessCode加载打印服务协议单
     *
     * @param data 业务编码数据
     * @return
     * @author LiCongLu
     * @date 2020-04-10 09:41
     */
    @ApiOperation(value = "根据funeral_dead表中businessCode加载打印服务协议单", notes = "根据businessCode加载打印服务协议单所需要的数据")
    @PostMapping("/load-print-service-agreement-with-business-code")
    public BaseResult<ServiceAgreementItem> loadPrintServiceAgreementWithBusinessCode(@RequestBody BusinessCodeData data) {
        return resultHandler(data, userItem -> serviceNegotiationService.loadPrintServiceAgreementWithBusinessCode(data));
    }
}
